package com.kyl.service.impl;


import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.kyl.base.PageResponse;
import com.kyl.mapper.NursingTaskMapper;
import com.kyl.service.NursingTaskService;
import com.kyl.vo.NursingTaskVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * @author WanJl
 * @version 1.0
 * @title NursingTaskServiceImpl
 * @description
 * @create 2025/1/18
 */
@Service
@Slf4j
public class NursingTaskServiceImpl implements NursingTaskService {
    @Resource
    private NursingTaskMapper nursingTaskMapper;
    @Override
    public PageResponse<NursingTaskVo> getTaskPage(
            Integer pageNum, Integer pageSize, Integer status,
            LocalDateTime startTime, LocalDateTime endTime, Long nursingId,
            String elderName, Integer projectId) {

        //分页条件
        PageHelper.startPage(pageNum, pageSize,"estimated_server_time ASC");
        Page<NursingTaskVo> page = nursingTaskMapper.getTaskPage(status, startTime, endTime, nursingId, elderName, projectId);

        return PageResponse.of(page, NursingTaskVo.class);
    }
}
